home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / Alpha 6.5.sit / Tcl / UserCode / vi.tcl < prev    next >
Text File  |  1994-05-30  |  18KB  |  680 lines

  1. # Alpha 5.x Init File
  2.  
  3. # ****************************************************************************
  4. # FILE:        vi.tcl
  5. # CONTENTS:    Alpha tcl startup for simple "vi" emulation.
  6. # AUTHOR: Peter H. Mills (phm@cs.duke.edu)
  7. # COPYRIGHT:
  8. #    Copyright ゥ 1994 by Peter H. Mills
  9. #    All rights reserved.
  10. #
  11. #    Redistribution and use in source and binary forms are permitted
  12. #    provided that the above copyright notice and this paragraph are
  13. #    duplicated in all such forms and that any documentation,
  14. #    advertising materials, and other materials related to such
  15. #    distribution and use acknowledge that the software was developed
  16. #    by Peter H. Mills.
  17. #
  18. #    THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  19. #    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  20. #    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. # ***************************************************************************
  22.  
  23. # ==========================================
  24. # ==== Vi MODE  (Vi, Insert, Ex)    ====
  25. # ==========================================
  26. # VI    (visual    editor --- minimal subset)   --- by Peter Mills
  27. #
  28. # INTRODUCTION:
  29. #    This is a tcl package for Alpha that supports a subset of vi mode
  30. #    and an extremely small set of ex commands.
  31. # USAGE:
  32. #    You should "source" this file in your userStartup.tcl file.
  33. #    (See AlphaBits.tcl for an example of "source" command usage).
  34. #    The file will automatically add an entry for "Vi" to the mode menu
  35. #    (the lower left-hand window box), which allows you to enter vi mode.
  36. #    (Alternatively, to enter vi mode execute the command "setViMode";
  37. #    to exit vi mode simply use the normal Alpha mode switching technique.)
  38. #    To have vi mode entered automatically on file open, you must
  39. #    alter the "setWinMode{}" function in SystemCode:procs.tcl
  40. #    which chooses the mode based on recognizing file suffixes
  41. #    (or, if using Mills' advanced "modeprocs.tcl" and "modes.tcl", 
  42. #    by overriding the "modeOfFileName" function in "modes.tcl").
  43. # SUMMARY of vi COMMANDS supported:
  44. #    MODE SWITCH:    i (insert mode)
  45. #            ESC (end insert mode, or abort in vi mode),
  46. #            : (ex mode -- very limited, don't use it).
  47. #            ^z (switch from vi mode to text mode)
  48. #    MOTION:        h,j,k,l,0,$, DEL (backward), CR (nextline), ^f, ^b,
  49. #            w,b,e,z, ^1 (home), ^$ (lastline)
  50. #    EDITING:    c<w,$>    i   a    A   o    O   s
  51. #            d<w,$,d,L>  x    J   ("r" == s)    d<R=rest,B=before>    
  52. #    MARKS:        m (set named mark)    ' (goto named mark)
  53. #            ^m (set mark)        ^' (exchangePointAndMark)
  54. #    CUT & PASTE:    p (yank)    dx (cut)   dc (copy)   dv (paste)
  55. #    SEARCH:        / (forward)   ? (backward)   n (find next)
  56. #            ^% (balance, matchbrace)
  57. #    UNDO/REDO:    u    undo (history)
  58. #            .    redo (ONLY on "d" and insert-ops <c,i,A,o>)
  59. #            (Redo lastcommand above, ignores intervening history.
  60. #    STATUS:        ^g
  61. # EX mode:
  62. #    MOTION:        1 (home)    $ (end)        g (goto line)
  63. #    CUT & PASTE:    x (cut)            c (copy)    v (paste)
  64. #            X (cut named clipb)    C (copy named)    V (paste named)
  65. #    FILE and WINDOW: q (quit)  r (read)  w (save)  n (new win)  s (save As)
  66. #             S (save selection)  p (copy sel to new wind)
  67. # *****************************************************************************
  68.  
  69. # ==========================================
  70. # ==== Vi MODE  (Vi, Insert, Ex)    ====
  71. # ==========================================
  72. #  Vi Mode:
  73. #    Variables
  74. #    Functions: Edit
  75. #    Functions: Mode
  76. #    Key Bindings: Vi, Insert, Ex Modes
  77. #===========================================
  78.  
  79. # ==========================
  80. # ==== VARIABLES
  81. # ==========================
  82. # ==== Constants ====
  83. set esc 0x35
  84. set del 0x33
  85. set cr  0x24
  86. set spc 0x31
  87. set quot 0x27
  88. if {! [info exists altesc]} { set altesc 0x35 }
  89. # ==== Redo History ====
  90. set viLastCmd ""
  91. set viInsertText ""
  92. # ==== Search Params ====
  93. set searchStr ""
  94. set searchWrap 1
  95. set forward 1
  96. set regExpr 1
  97. set ignoreCase 1
  98. set matchWords 0
  99.  
  100.  
  101. # =====================================================================
  102. # ==========================
  103. # ==== MODE FUNCTIONS    ====
  104. # ==========================
  105.  
  106. #=========================================================
  107. #    COPIED from modeprocs.tcl (by Peter Mills)
  108. #    DEPENDENCES:  changeMode(mode), winNameToNum(name)
  109. #====
  110. #    SUBMODE is name, used by "displayMode", of a set of KEY BINDINGS.
  111. #====
  112. if {! [info exists modeprocs_defined]} {
  113. set curWinId -1
  114. set subMode ""
  115. proc changeSubMode {newSubMode {wname ""}} {
  116.     global subMode
  117.     global curWinId
  118.     global winNumToSubMode
  119.     set curWinName [lindex [winNames -f] 0]
  120.     set curWinId [getWinId $curWinName]
  121.     if {$wname == ""} { set winId $curWinId
  122.     } else { set winId [getWinId $wname] }
  123.     if {$winId >= 0} { set winNumToSubMode($winId) $newSubMode }
  124.     if {$winId != $curWinId} { return }
  125.     displayMode $newSubMode
  126.     set subMode $newSubMode
  127. }
  128. proc getWinId wname {
  129.     global winNameToNum
  130.     if {[catch { set winId $winNameToNum($wname) }]} { set winId -1 }
  131.     return $winId
  132. }
  133. proc addMode {mode modeProc modeWinFunc modeMenu} {
  134.   global modes
  135.   global modeProcs modeWinFuncTitle modeAddMenu
  136.     lappend modes $mode
  137.     set modeProcs($mode) $modeProc
  138.     set modeWinFuncTitle($mode) $modeWinFunc
  139.     set modeAddMenu($mode) $modeMenu
  140. }
  141. }
  142. #=========================================================
  143. catch {
  144.   if {([info exists modes]) && ([lsearch -exact $modes "Vi"] < 0)} {
  145.     addMode Vi setViMode "Func" "" }
  146. }
  147.  
  148.  
  149. #====
  150. # ==== SUBMODE (Minor Mode)
  151. #
  152. # WARNING:    viSubMode, viInsertText should be BUFFER LOCAL (curWinId)
  153. #
  154. # "subMode" from modes.tcl, *is* buffer local -- changeSubMode().
  155. #====
  156.  
  157. # ==== SWITCH to VI Command Mode ====
  158. proc viCmdMode {} { changeSubMode "Vi" }
  159.  
  160. # changeMode: restores mode-local params, sets 1st time to TextModeParams
  161. proc setViMode {} {
  162.     changeMode "Vi"
  163.     uplevel #0 {
  164.         set wordBreak "$viWordBreak"
  165.         set wordBreakPreface "$viWordBreakPreface"
  166.     }
  167.     viCmdMode
  168. }
  169.  
  170. proc setViModeOff {} {
  171.     message "Exiting vi mode"
  172.     changeMode "Text"
  173. }
  174.  
  175. proc viRedoLastCmd {} {
  176.     global viLastCmd
  177.     global subMode
  178.     if {$viLastCmd == ""} {
  179.         abortEm
  180.         return 
  181.     }
  182.     set subMode "Vi"
  183.     $viLastCmd
  184.     if {$subMode == "Insert"} { viRedoInsert }
  185. }
  186.  
  187.  
  188. # ==== SWITCH to VI Insert Mode ====
  189. proc viInsertCmd {} {
  190.     global viLastCmd
  191.     global curWinId
  192.     changeSubMode "Insert"
  193.     set viLastCmd viInsertCmd
  194.     if {[getPos] != [selEnd]} { deleteText [getPos] [selEnd] }
  195.     createTMark "viIns$curWinId" [getPos]
  196. }
  197.  
  198. proc viInsertMode {} {
  199.     global curWinId
  200.     changeSubMode "Insert"
  201.     createTMark "viIns$curWinId" [getPos]
  202. }
  203.  
  204. # END INSERT: save inserted text in insert-buffer, switch to VI Command Mode.
  205. # PROBLEM:  "viIns" mark may be gone via deletion past insert-point (~bind redo)
  206. proc viEndInsMode {} {
  207.     global viInsertText
  208.     global curWinId
  209. #    # (viCmdMode)
  210.     changeSubMode "Vi"
  211.     set end [getPos]
  212.     if [catch { gotoTMark "viIns$curWinId" }] { beep ; return }
  213. #    # removeTMark "viIns$curWinId"    --- auto at win close
  214.     set start [getPos]
  215.     goto $end
  216.     if {$start >= $end} { return }
  217.     set viInsertText [getText $start $end]
  218. }
  219.  
  220. proc viRedoInsert {} {
  221.     global viInsertText
  222.     if {[getPos] == [selEnd]} { insertText $viInsertText
  223.     } else { replaceText [getPos] [selEnd]  $viInsertText }
  224.     viCmdMode
  225. }
  226.  
  227.  
  228. # ==== SWITCH to vi EX Mode ====
  229. proc viExMode {} {
  230.     changeSubMode "Ex"
  231.     message "ex Mode"
  232. }
  233.  
  234.  
  235. # =====================================================================
  236. # ==========================
  237. # ==== EDIT FUNCTIONS (WORD MOTION)
  238. # ==========================
  239. set viWordBreak {(([a-zA-Z0-9_]+)|([!-/:-@¥[-^¥`¥{-~]+))}
  240. set viWordBreakPreface {([^a-zA-Z0-9_])}
  241. set viSWordBreakPreface ¥
  242.  {(([^a-zA-Z0-9_]([a-zA-Z0-9_]+))|([^!-/:-@¥[-^¥`¥{-~]([!-/:-@¥[-^¥`¥{-~]+)))}
  243. set viNonWhiteSpace {[!-~]}
  244.  
  245. proc viEndOfWord {} {
  246.     global viWordBreak
  247.     set retval [search -f 1 -r 1 -i 1 -m 0 -n "$viWordBreak" [getPos]] 
  248.     if {($retval != "")} {
  249.         set retval [lindex $retval 1]
  250.         goto $retval }
  251. }
  252.  
  253. proc viBackwardWord {} {
  254.     global viSWordBreakPreface
  255.     set start [getPos]
  256.     if {($start > 1)} { incr start -2 }
  257.     set retval [search -f 0 -r 1 -i 1 -m 0 -n "$viSWordBreakPreface" $start]
  258.     if {($retval != "")} {
  259.         set retval [lindex $retval 0]
  260.         goto $retval
  261.         forwardChar }
  262. }
  263.  
  264. proc viForwardWord {} {
  265.     global viSWordBreakPreface
  266.   set retval [search -f 1 -r 1 -i 1 -m 0 -n "$viSWordBreakPreface" [getPos]] 
  267.     if {($retval != "")} {
  268.         set retval [lindex $retval 0]
  269.         goto $retval
  270.         forwardChar }
  271. }
  272.  
  273.  
  274. # ==========================
  275. # ==== EDIT FUNCTIONS    ====
  276. # ==========================
  277. proc viDeleteCharX {} {
  278.     set start [getPos]
  279.     set point_max [maxPos]
  280.     if {($start >= $point_max) || ([lookAt [getPos]] == "¥n")  ||
  281.         ([lookAt [getPos]] == "¥r")} { backwardChar }
  282.     deleteChar
  283. }
  284.  
  285. proc viDeleteCharB {} {
  286.     backwardChar
  287.     deleteChar
  288. }
  289.  
  290. proc viDeleteCharSel {} {
  291.     if {[getPos] == [selEnd]} {
  292.         backwardChar
  293.         deleteChar
  294.     } else { deleteText [getPos] [selEnd] }
  295. }
  296.  
  297. proc viTypeSpace {} {
  298.     insertText " "
  299. }
  300.  
  301.  
  302. proc viYank {} {
  303.     global viLastCmd
  304.     set viLastCmd viYank
  305.     endOfLine
  306.     yank
  307.     beginningOfLine
  308. }
  309.  
  310.  
  311. proc viJoinLine {} {
  312.     global viLastCmd
  313.     global viNonWhiteSpace
  314.     set viLastCmd viJoinLine
  315.     createTMark "viTmp" [getPos]
  316.     endOfLine
  317.     deleteChar
  318. #    #    STRIP WHITE SPACE
  319.     set start [getPos]
  320.     set retval [search -f 1 -r 1 -i 1 -m 0 -n "$viNonWhiteSpace" $start]
  321.     if {($retval != "")} { set retval [lindex $retval 0]
  322.     } else { set retval $start }
  323.     if {$start < $retval} { deleteText $start $retval }
  324. #
  325.     insertText " "
  326.     gotoTMark "viTmp"
  327.     removeTMark "viTmp"
  328. }
  329.  
  330. proc viOpenLine {} {
  331.     global viLastCmd
  332.     set viLastCmd viOpenLine
  333.     endOfLine
  334.     carriageReturn
  335.     viInsertMode
  336. }
  337.  
  338. proc viOpenLineB {} {
  339.     openLine
  340.     viInsertMode
  341. }
  342.  
  343. proc viDeleteLineEnd {} {
  344.     global viLastCmd
  345.     set viLastCmd viDeleteLineEnd
  346.     set start [getPos]
  347.     endOfLine
  348.     deleteText $start [getPos]
  349. }
  350.  
  351. proc viDeleteLine {} {
  352.     global viLastCmd
  353.     set viLastCmd viDeleteLine
  354.     endOfLine
  355.     set end [getPos]
  356.     previousLine
  357.     endOfLine
  358.     deleteText [getPos] $end
  359.     beginningOfLine
  360.     nextLine
  361. }
  362.  
  363. proc viDeletePage {} {
  364.     global viLastCmd
  365.     set viLastCmd viDeletePage
  366.     set start [getPos]
  367.     pageForward
  368.     moveInsertionHere
  369.     deleteText $start [getPos]
  370. }
  371.  
  372. proc viDeleteRest {} {
  373.     global viLastCmd
  374.     set viLastCmd ""
  375.     set start [getPos]
  376.     endOfBuffer
  377.     deleteText $start [getPos]
  378. }
  379.  
  380. proc viDeleteAllBefore {} {
  381.     global viLastCmd
  382.     set viLastCmd ""
  383.     set end [getPos]
  384.     beginningOfBuffer
  385.     deleteText [getPos] $end
  386. }
  387.  
  388. proc viDeleteWord {} {
  389.     global viLastCmd
  390.     set viLastCmd viDeleteWord
  391.     set start [getPos]
  392.     viForwardWord
  393.     set end [getPos]
  394.     if {$start < $end} { deleteText $start $end }
  395. }
  396.  
  397. proc viAdd {} {
  398.     global viLastCmd
  399.     set viLastCmd viAdd
  400.     viForwardWord
  401.     viInsertMode
  402. }
  403.  
  404. proc viAddEnd {} {
  405.     global viLastCmd
  406.     set viLastCmd viAddEnd
  407.     endOfLine
  408.     viInsertMode
  409. }
  410.  
  411. proc viChangeLine {} {
  412.     global viLastCmd
  413.     set viLastCmd viChangeLine
  414.     set start [getPos]
  415.     endOfLine
  416.     select $start [getPos]
  417.     viInsertMode
  418. }
  419.  
  420. proc viChangeWord {} {
  421.     global viLastCmd
  422.     set viLastCmd viChangeWord
  423.     set start [getPos]
  424.     viEndOfWord
  425.     select $start [getPos]
  426.     viInsertMode
  427. }
  428.  
  429. proc viSubChar {} {
  430.     global viLastCmd
  431.     set viLastCmd viSubChar
  432.     set start [getPos]
  433.     set end $start
  434.     incr end
  435.     select $start $end
  436.     viInsertMode
  437. }
  438.  
  439. # Search with Wrap (searchWrap) ; 
  440. #    Max_Position(File) = {0,[maxPos]-1}
  441. proc viSearch {} {
  442.     global searchStr
  443.     global searchWrap
  444.     global forward
  445.     set start [getPos]
  446.     set point_max [expr {[maxPos] - 1}]
  447.     if {$forward} { if {($start < $point_max)} { incr start }
  448.     } else { if {$start > 0} { incr start -1 } }
  449.     set retval [search -f $forward -n -- "$searchStr" $start]
  450.     if {($retval == "") && $searchWrap} {
  451.       if {$forward} { set frompos 0 } else { set frompos $point_max }
  452.       if {$forward} {
  453.        set retval [search -f $forward -n -l $start -- "$searchStr" $frompos] 
  454.       } else {
  455.         set retval [search -f $forward -n -- "$searchStr" $frompos] 
  456.         if {($retval != "") && ([lindex $retval 0] < $start)} { 
  457.         set retval ""} }
  458.     }
  459.     if {$retval == ""} { beep } else { goto [lindex $retval 0] }
  460. }
  461.  
  462. proc viSearchBackward {} {
  463.     global searchStr
  464.     global forward
  465.     if [catch { prompt "Search for: " $searchStr } retval] { return }
  466.     set forward 0
  467.     set searchStr $retval
  468.     viSearch
  469. }
  470.  
  471. proc viSearchForward {} {
  472.     global searchStr
  473.     global forward
  474.     if [catch { prompt "Search for: " $searchStr } retval] { return }
  475.     set forward 1
  476.     set searchStr $retval
  477.     viSearch
  478. }
  479.  
  480. proc viRedoSearch {} {
  481.     global forward
  482.     if {$forward} { repeatSearchForward } else { repeatSearchBackward }
  483. }
  484.  
  485.  
  486.  
  487. proc viCopySelWind {} {
  488.     if {[getPos] == [selEnd]} { return }
  489.     set text [getText [getPos] [selEnd]]
  490.     new
  491.     moveInsertionHere
  492.     insertText $text
  493. }
  494. # (view named clipboard, copy and view clipboard)
  495. # ==== save selection to file ====
  496. proc viSaveSelection {} {
  497.     viCopySelWind 
  498.     saveAs
  499.     killWindow
  500. }
  501.  
  502.  
  503.  
  504. # =====================================================================
  505. # ==========================
  506. # ==== KEY BINDINGS    ====
  507. # ==========================
  508. # ==== BINDINGS for EMACS (deleted from original) ====
  509. # bind 'j' <e>        fillRegion
  510. # bind 'p' <e>        fillParagraph
  511. # bind '<' <se>        beginningOfBuffer
  512. # bind '>' <se>        endOfBuffer
  513. bind 'z' <z>    setViMode
  514.  
  515. # ==================================
  516. # ==== INSERT MODE BINDINGS    ====
  517. # ==================================
  518. bind $esc    viEndInsMode    "Insert"
  519. bind $altesc    viEndInsMode    "Insert"
  520. bind $del    viDeleteCharSel    "Insert"
  521. bind $del <s>    viDeleteCharSel    "Insert"
  522. bind '¥n'    carriageReturn    "Insert"
  523. bind '¥n' <s>    carriageReturn    "Insert"
  524. bind '¥r'    carriageReturn    "Insert"
  525. bind '¥r' <s>    carriageReturn    "Insert"
  526. bind $spc    viTypeSpace    "Insert"
  527. bind $spc <s>    viTypeSpace    "Insert"
  528. bind 'z' <z>    setViModeOff    "Insert"
  529.  
  530. # ==========================
  531. # ==== VI MODE BINDINGS    ====
  532. # ==========================
  533. #    ESC==abort (reset so not void redo "viIns"), ' '==special
  534. #    DEL==backwardChar (vs. backSpace)
  535. bind $esc    abortEm        "Vi"
  536. bind $altesc    abortEm        "Vi"
  537. bind $del    viDeleteCharSel    "Vi"
  538. bind $del <s>    viDeleteCharSel    "Vi"
  539. bind '¥n'    nextLine    "Vi"
  540. bind '¥n' <s>    nextLine    "Vi"
  541. bind '¥r'    nextLine    "Vi"
  542. bind '¥r' <s>    nextLine    "Vi"
  543. bind $spc    forwardChar    "Vi"
  544. bind $spc <s>    forwardChar    "Vi"
  545. bind 'i'    viInsertCmd    "Vi"
  546. bind ':' <s>    viExMode    "Vi"
  547. bind 'z' <z>    setViModeOff    "Vi"
  548. bind '¥'    startEscape    "Vi"
  549. bind '¥' <e>    evalCommand    "Vi"
  550.  
  551. bind 'a'    viAdd        "Vi"
  552. bind 'a' <s>    viAddEnd    "Vi"
  553. bind 'b'    viBackwardWord    "Vi"
  554. bind 'c'    prefixChar    "Vi"
  555. bind 'd'    prefixChar    "Vi"
  556. bind 'e'    viEndOfWord    "Vi"
  557. bind 'g'    currentPosition    "Vi"
  558. bind 'h'    backwardChar    "Vi"
  559. bind 'j'    nextLine    "Vi"
  560. bind 'j' <s>    viJoinLine    "Vi"
  561. bind 'k'    previousLine    "Vi"
  562. bind 'l'    forwardChar    "Vi"
  563. bind 'm'    setNamedMark    "Vi"
  564. bind 'n'    viSearch    "Vi"
  565. bind 'o'    viOpenLine    "Vi"
  566. bind 'o' <s>    viOpenLineB    "Vi"
  567. bind 'p'    viYank        "Vi"
  568. bind 'r'    viSubChar    "Vi"
  569. bind 's'    viSubChar    "Vi"
  570. bind 't'    viEndOfWord    "Vi"
  571. bind 'u'    undo        "Vi"
  572. bind 'v'    viBackwardWord    "Vi"
  573. bind 'w'    viForwardWord    "Vi"
  574. bind 'x'    viDeleteCharX    "Vi"
  575. bind 'y'    yank        "Vi"
  576. bind 'z'    insertToTop    "Vi"
  577. bind '0'    beginningOfLine    "Vi"
  578. bind '%' <s>    balance        "Vi"
  579. bind '$' <s>    endOfLine    "Vi"
  580. bind $quot    gotoNamedMark    "Vi"
  581. bind '/'    viSearchForward    "Vi"
  582. bind '?' <s>    viSearchBackward "Vi"
  583. #====
  584. #    ' marks (^' for '')
  585. #    m: named mark (^m for set current mark)
  586. #    n: repeatSearchForward (redo commands (persistent))
  587. #    d: <x>  w or $    
  588. #    c: <e>  w or $        
  589. #====
  590.  
  591. # ==================================================================
  592. # ==== VI MODE BINDINGS -- PERMANENT (prefixed) SETTINGS    ====
  593. # ==================================================================
  594. bind 'a' <z>    beginningOfLine    "Vi"
  595. bind 'b' <z>    pageBack    "Vi"
  596. bind 'e' <z>    endOfLine    "Vi"
  597. bind 'f' <z>    pageForward    "Vi"
  598. bind 'g' <z>    currentPosition    "Vi"
  599. bind 'h' <z>    backwardChar    "Vi"
  600. bind 'j' <z>    nextLine    "Vi"
  601. bind 'k' <z>    previousLine    "Vi"
  602. bind 'l' <z>    forwardChar    "Vi"
  603. bind 'n' <z>    scrollDownLine    "Vi"
  604. bind 'p' <z>    scrollUpLine    "Vi"
  605. bind 'q' <z>    keyAscii    "Vi"
  606. bind 'r' <z>    fillParagraph    "Vi"
  607. #  REGION SELECT/EDIT
  608. bind 't' <z>    viEndOfWord    "Vi"
  609. bind 'u' <z>    undo        "Vi"
  610. bind 'v' <z>    viBackwardWord    "Vi"
  611. bind 'w' <z>    viForwardWord    "Vi"
  612. bind 'y' <z>    viYank        "Vi"
  613. bind '1' <z>    beginningOfBuffer "Vi"
  614. bind '4' <z>    endOfBuffer    "Vi"
  615. bind '5' <z>    balance        "Vi"
  616. bind '.'    viRedoLastCmd    "Vi"
  617. #    . : redo command (history sensitive)
  618.  
  619. # ==== DELETE MODE MODIFIERS (d prefix)
  620. bind 'd' <z>    prefixChar    "Vi"
  621. bind 'x' <D>    cut        "Vi"
  622. bind 'c' <D>    copy        "Vi"
  623. bind 'v' <D>    paste        "Vi"
  624. bind 'w' <D>    viDeleteWord    "Vi"
  625. bind 'd' <D>    viDeleteLine    "Vi"
  626. bind '$' <sD>    viDeleteLineEnd    "Vi"
  627. bind 'L' <sD>    viDeletePage    "Vi"
  628. bind 'R' <sD>    viDeleteRest    "Vi"
  629. bind 'B' <sD>    viDeleteAllBefore "Vi"
  630.  
  631. # ==== CHANGE MODE MODIFIERS (c prefix)
  632. bind 'c' <z>    prefixChar    "Vi"
  633. bind 'w' <C>    viChangeWord    "Vi"
  634. bind '$' <Cs>    viChangeLine    "Vi"
  635.     
  636. # === MARK MODE MODIFIERS (^') ====
  637. bind $quot <z> exchangePointAndMark "Vi"
  638. bind 'm' <z> setMark        "Vi"
  639. bind '^' <z> exchangePointAndMark "Vi"
  640. bind '@' <z> setMark        "Vi"
  641.  
  642. # ==========================
  643. # ==== EX MODE BINDINGS    ====
  644. # ==========================
  645. bind $esc    viCmdMode    "Ex"
  646. bind $altesc    viCmdMode    "Ex"
  647. bind $del    viDeleteCharB    "Ex"
  648. bind $del <s>    viDeleteCharB    "Ex"
  649. bind '¥n'    viCmdMode    "Ex"
  650. bind '¥n' <s>    viCmdMode    "Ex"
  651. bind '¥r'    viCmdMode    "Ex"
  652. bind '¥r' <s>    viCmdMode    "Ex"
  653. bind 'z' <z>    setViModeOff    "Ex"
  654.  
  655. bind 'c'    copy        "Ex"
  656. bind 'c' <s>    copyNamedClipboard "Ex"
  657. bind 'g'    gotoLine    "Ex"
  658. bind 'n'    new        "Ex"
  659. bind 'p'    viCopySelWind    "Ex"
  660. bind 'q'    killWindow    "Ex"
  661. bind 'r'    insertFile    "Ex"
  662. bind 's'    saveAs        "Ex"
  663. bind 's' <s>    viSaveSelection    "Ex"
  664. bind 'v'    paste        "Ex"
  665. bind 'v' <s>    pasteNamedClipboard "Ex"
  666. bind 'w'    save        "Ex"
  667. bind 'x'    cut        "Ex"
  668. bind 'x' <s>    cutNamedClipboard "Ex"
  669. bind '1'    beginningOfBuffer "Ex"
  670. bind '$' <s>    endOfBuffer    "Ex"
  671. # ***************************************************************************
  672. #                 END of VI section.
  673. # ***************************************************************************
  674.  
  675. #===================================
  676. # ==== EMACS MODE BINDINGS    ====
  677. #===================================
  678.  
  679. #======================== END NUMLINES 777 ====================================
  680.